<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>计算属性的getter和setter</title>
    <script src="../../框架/vue.js"></script>
</head>
<body>
<div id="app">
    <h3>顾客你好</h3>
    <p>
        你购买的手机品牌是{{company}}<br>
        单价是{{price}}元<br>
        数量是{{count}}部<br>
<!--        总价是{{total()}}元-->
        总价是{{total}}元
    </p>
</div>
<script>
    let b = new Vue({
        el:'#app',
        data:{
            company:'华为',
            price:2000,
            count:10
        },
        methods:{
            total:function (){
                console.log('counted')
                return this.price * this.count
            }
        },
        computed:{
            total:function (){
                console.log('counted')
                return this.price * this.count
            }
        }
    });
</script>
</body>
</html>